package fr.vvins.core.user.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import fr.vvins.core.user.entity.UserRating;
@Repository
public interface UserRatingRepository extends CrudRepository<UserRating, Integer> {

	@Query("from UserRating where product.id=?1")
	List<UserRating> findByUserId(Integer id);

	@Query("from UserRating where vigneron.id=?1")
	List<UserRating> findByVigneronId(Integer id);

	@Query("from UserRating where product.id=?1")
	List<UserRating> findByProductId(Integer id);

	@Query("from UserRating where vigneron.content.id=?1")
	List<UserRating> findByVigneronContentId(Integer id);

	@Query("from UserRating where product.content.id=?1")
	List<UserRating> findByProductContentId(Integer id);

	@Query("from UserRating where vigneron.content.key=?1")
	List<UserRating> findByVigneronContentKey(String key);

	@Query("from UserRating where product.content.key=?1")
	List<UserRating> findByProductContentKey(String key);

}
